package com.zengde.chapter1.controller;

import com.zengde.chapter1.model.Person;
import com.zengde.chapter1.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class PersonController {
    @Autowired
    private PersonService personService;

    // 测试接口：访问 http://localhost:8080/check-person 触发规则
    @GetMapping("/check-person")
    public String checkPerson() {
        // 创建测试数据
        Person adult = new Person("张三", 25);
        Person minor = new Person("李四", 16);

        // 执行规则匹配
        personService.checkPerson(adult);
        personService.checkPerson(minor);

        return "规则执行完成，查看控制台输出";
    }
}